﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Company.Merchandising.BusinessLayer.DataEntities;

namespace Company.Merchandising.DataAccessLayer.DataAccessCommon
{
	public class DACChainStore : DACBase
	{
		public DACChainStore(MerchModelEntities modelEntities) : base(modelEntities) { }

		public IQueryable<ChainStore> GetAllChainStores()
		{
			return from chain in _modelEntities.ChainStore select chain;
		}

		public ChainStore GetChainStoreById(int chainStoreId)
		{
			return (from chain in _modelEntities.ChainStore where chain.Id == chainStoreId select chain).FirstOrDefault();
		}

		public IQueryable<ChainStore> GetChainStoresByName(string chainStoreName)
		{
			return from chain in _modelEntities.ChainStore where chain.Name == chainStoreName select chain;
		}

		public IQueryable<ChainStore> GetChainStoresByNameAndOtherId(string chainStoreName, int chainStoreId)
		{
			return from chain in _modelEntities.ChainStore where chain.Name == chainStoreName && chain.Id != chainStoreId select chain;
		}
	}
}
